#!/bin/bash

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

pushd $(dirname "$0") > /dev/null

{% if cluster_cfg['docker-cache']['enabled'] %}
kubectl apply --overwrite=true -f docker-cache-config.yaml || exit $?
kubectl apply --overwrite=true -f docker-cache-secret.yaml || exit $?
kubectl apply --overwrite=true -f docker-cache.yaml || exit $?
kubectl apply --overwrite=true -f docker-cache-service.yaml || exit $?

# Wait until the service is ready.
PYTHONPATH="../../../deployment" python -m  k8sPaiLibrary.monitorTool.check_pod_ready_status -w -k app -v docker-registry-cache || exit $?
{% else %}
{% endif %}

popd > /dev/null
